package com.atguigu.daijia.customer.config;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import me.chanjar.weixin.common.service.WxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 山顶洞人郑某
 * @className WxConfigOperator.java 配置微信服务bean
 * @date 2024 09 04
 */
@Configuration
public class WxConfigOperator {
    @Autowired
    private WxConfigProperties wxConfigProperties;
  //配置微信开发service
    @Bean
    public WxMaService wxService() {
        WxMaDefaultConfigImpl wxMaConfig = new WxMaDefaultConfigImpl();
        wxMaConfig.setAppid(wxConfigProperties.getAppId());
        wxMaConfig.setSecret(wxConfigProperties.getSecret());
        WxMaService wxService = new WxMaServiceImpl();
        wxService.setWxMaConfig(wxMaConfig);
        return wxService;
    }

}
